package com.wxy.ej.flow.modules.act.listen;


import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.Expression;
import org.activiti.engine.delegate.JavaDelegate;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Slf4j
@Component("serviceTask")
@Scope("prototype")
public class ServiceTask implements JavaDelegate{

    //流程变量
    private Expression text1;

    //重写委托的提交方法
    @Override
    public void execute(DelegateExecution execution) {
        log.info("---->act listener: ServiceTask");
        /*String value1 = (String) text1.getValue(execution);
        String flowElementName = execution.getCurrentFlowElement().getName();
        System.out.println("=======》serviceTask已经执行; 节点名称："+flowElementName+" value1："+value1);


        // 流程执行日志
        FlowElement flowElement = execution.getCurrentFlowElement();
        // ${companyId}
        String doc = ExpressionUtils.parse(flowElement.getDocumentation(), execution);


        CtcTaskLogBizDto taskLogDto = new CtcTaskLogBizDto();
        taskLogDto.setCtcTaskId(Long.parseLong(execution.getProcessInstanceBusinessKey()));
        taskLogDto.setFlowElementId(flowElement.getId());
        taskLogDto.setFlowElementName(flowElement.getName());
        taskLogDto.setFlowElementDoc(doc);
        taskLogDto.setCreatedate(DateTool.currentDate("yyyy-MM-dd HH:mm:ss.SSS"));
        StringBuilder sb = new StringBuilder();
        sb.append("服务任务执行；");
        sb.append("流程变量："+value1);
        taskLogDto.setDescription(sb.toString());
        ctcTaskLogBizService.create(taskLogDto);*/
    }


}
